package com.sinping.qh.config;

import com.sinping.qh.api.filter.AppAuthFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

/**
 * @author zhangjin
 * @create 2018/6/2
 */
@Configuration
public class AppFilterConfig {

    @Bean
    public FilterRegistrationBean appFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(appAuthFilter());
        registration.addUrlPatterns("/api/v1/app/*");
        registration.setName("appAuthFilter");
        return registration;
    }
    @Bean
    public Filter appAuthFilter(){
        return new AppAuthFilter();
    }
}
